package core;

import java.util.HashMap;
import java.util.LinkedList;

import util.Constants;

/**
 * 
 * @author Xiaohui
 * 
 */
public class Junctions implements Constants {
	HashMap<Integer, Junction> juns; // jid => junction

	public Junctions() {
		juns = new HashMap<Integer, Junction>(numJunctions);
	}

	public Junction getJuncById(int jid) {
		return juns.get(jid);
	}

//Insert a junction
	public void insert(Junction junction){
		Junction temp = juns.get(junction.getId());
		if (temp != null){
			System.err.println("junctions with same id "+temp+" : "+junction);
		}else{
			juns.put(junction.getId(), junction);
			
		}
	}
	public Junction delete(int jid){
		Junction temp = juns.get(jid);
		juns.remove(jid);
		
		return temp;
	}

	public int getSize() {
		return juns.size();
	}
}
